﻿using Microsoft.AspNetCore.Mvc;
using MvcSample.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MvcSample.Components
{
    public class StudentCountViewComponent
        : ViewComponent
    {
        private readonly IStudentService _studentService;
        public StudentCountViewComponent(IStudentService studentService)
        {
            _studentService = studentService;
        }
        public IViewComponentResult Invoke(int id,string name)
        {
            var count = _studentService.GetCountAsync().Result;
            return View(count);
        }
    }
}
